package com.htsk.city.services.wechat.vo;

import cn.hutool.core.date.DateUtil;
import com.htsk.city.services.core.domain.Comment;
import lombok.Data;

import java.util.List;

@Data
public class CommentVO {
    private Long commentId;
    private Long postId;
    private Long parentCommentId;
    private String content;
    private Integer likeCount;
    private String createdAt;
    private UserInfoVO userInfo;
    private UserInfoVO replyToUser;
    private List<CommentVO> children;
    private boolean isLiked;

    public CommentVO(Comment comment,UserInfoVO userInfo,UserInfoVO replyToUser,List<CommentVO> children,boolean isLiked) {
        this.commentId = comment.getId();
        this.postId = comment.getPostId();
        this.parentCommentId = comment.getParentId();
        this.content = comment.getContent();
        this.likeCount = comment.getLikeCount();
        this.createdAt =  DateUtil.formatDateTime(comment.getCreatedAt());
        this.userInfo=userInfo;
        this.replyToUser=replyToUser;
        this.children=children;
        this.isLiked=isLiked;
    }
}
